<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, height=device-height, initial-scale=1, user-scalable=no">
  <meta name="description" content="API docs for the buildToolbar method from the JidoujishoTextSelectionControls class, for the Dart programming language.">
  <title>buildToolbar method - JidoujishoTextSelectionControls class - utils library - Dart API</title>


  
  <link rel="preconnect" href="https://fonts.gstatic.com">
  <link href="https://fonts.googleapis.com/css2?family=Roboto+Mono:ital,wght@0,300;0,400;0,500;0,700;1,400&display=swap" rel="stylesheet">
  <link href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@48,400,0,0" rel="stylesheet">
  
  <link rel="stylesheet" href="../../static-assets/github.css?v1">
  <link rel="stylesheet" href="../../static-assets/styles.css?v1">
  <link rel="icon" href="../../static-assets/favicon.png?v1">

  
</head>


<body data-base-href="../../" data-using-base-href="false" class="light-theme">

<div id="overlay-under-drawer"></div>

<header id="title">
  <span id="sidenav-left-toggle" class="material-symbols-outlined" role="button" tabindex="0">menu</span>
  <ol class="breadcrumbs gt-separated dark hidden-xs">
    <li><a href="../../index.html">yuuna</a></li>
    <li><a href="../../utils/utils-library.html">utils</a></li>
    <li><a href="../../utils/JidoujishoTextSelectionControls-class.html">JidoujishoTextSelectionControls</a></li>
    <li class="self-crumb">buildToolbar method</li>
  </ol>
  <div class="self-name">buildToolbar</div>
  <form class="search navbar-right" role="search">
    <input type="text" id="search-box" autocomplete="off" disabled class="form-control typeahead" placeholder="Loading search...">
  </form>
  <div class="toggle" id="theme-button">
    <label for="theme">
      <input type="checkbox" id="theme" value="light-theme">
      <span id="dark-theme-button" class="material-symbols-outlined">
        brightness_4
      </span>
      <span id="light-theme-button" class="material-symbols-outlined">
        brightness_5
      </span>
    </label>
  </div>
</header>
<main>

  <div id="dartdoc-main-content" class="main-content">
      <div>
<h1><span class="kind-method">buildToolbar</span> method 
</h1></div>

    <section class="multi-line-signature">
      
  <div>
    <ol class="annotation-list">
        <li>@<a href="https://api.flutter.dev/flutter/dart-core/override-constant.html">override</a></li>
    </ol>
  </div>

<span class="returntype"><a href="https://api.flutter.dev/flutter/widgets/Widget-class.html">Widget</a></span>
<span class="name ">buildToolbar</span>(<wbr><ol class="parameter-list"><li><span class="parameter" id="buildToolbar-param-context"><span class="type-annotation"><a href="https://api.flutter.dev/flutter/widgets/BuildContext-class.html">BuildContext</a></span> <span class="parameter-name">context</span>, </span></li>
<li><span class="parameter" id="buildToolbar-param-globalEditableRegion"><span class="type-annotation"><a href="https://api.flutter.dev/flutter/dart-ui/Rect-class.html">Rect</a></span> <span class="parameter-name">globalEditableRegion</span>, </span></li>
<li><span class="parameter" id="buildToolbar-param-textLineHeight"><span class="type-annotation"><a href="https://api.flutter.dev/flutter/dart-core/double-class.html">double</a></span> <span class="parameter-name">textLineHeight</span>, </span></li>
<li><span class="parameter" id="buildToolbar-param-selectionMidpoint"><span class="type-annotation"><a href="https://api.flutter.dev/flutter/dart-ui/Offset-class.html">Offset</a></span> <span class="parameter-name">selectionMidpoint</span>, </span></li>
<li><span class="parameter" id="buildToolbar-param-endpoints"><span class="type-annotation"><a href="https://api.flutter.dev/flutter/dart-core/List-class.html">List</a><span class="signature">&lt;<wbr><span class="type-parameter"><a href="https://api.flutter.dev/flutter/rendering/TextSelectionPoint-class.html">TextSelectionPoint</a></span>&gt;</span></span> <span class="parameter-name">endpoints</span>, </span></li>
<li><span class="parameter" id="buildToolbar-param-delegate"><span class="type-annotation"><a href="https://api.flutter.dev/flutter/services/TextSelectionDelegate-mixin.html">TextSelectionDelegate</a></span> <span class="parameter-name">delegate</span>, </span></li>
<li><span class="parameter" id="buildToolbar-param-clipboardStatus"><span class="type-annotation"><a href="https://api.flutter.dev/flutter/widgets/ClipboardStatusNotifier-class.html">ClipboardStatusNotifier</a>?</span> <span class="parameter-name">clipboardStatus</span>, </span></li>
<li><span class="parameter" id="buildToolbar-param-lastSecondaryTapDownPosition"><span class="type-annotation"><a href="https://api.flutter.dev/flutter/dart-ui/Offset-class.html">Offset</a>?</span> <span class="parameter-name">lastSecondaryTapDownPosition</span></span></li>
</ol>)

      <div class="features"><span class="feature">override</span></div>

    </section>
    
<section class="desc markdown">
  <p>Builder for material-style copy/paste text selection toolbar.</p>
</section>


    
<section class="summary source-code" id="source">
  <h2><span>Implementation</span></h2>
  <pre class="language-dart"><code class="language-dart">@override
Widget buildToolbar(
  BuildContext context,
  Rect globalEditableRegion,
  double textLineHeight,
  Offset selectionMidpoint,
  List&lt;TextSelectionPoint&gt; endpoints,
  TextSelectionDelegate delegate,
  ClipboardStatusNotifier? clipboardStatus,
  Offset? lastSecondaryTapDownPosition,
) {
  final TextSelectionPoint startTextSelectionPoint = endpoints[0];
  final TextSelectionPoint endTextSelectionPoint =
      endpoints.length &gt; 1 ? endpoints[1] : endpoints[0];
  final Offset anchorAbove = Offset(
      globalEditableRegion.left + selectionMidpoint.dx,
      globalEditableRegion.top +
          startTextSelectionPoint.point.dy -
          textLineHeight -
          _kToolbarContentDistance);
  final Offset anchorBelow = Offset(
    globalEditableRegion.left + selectionMidpoint.dx,
    globalEditableRegion.top +
        endTextSelectionPoint.point.dy +
        _kToolbarContentDistanceBelow,
  );

  return JidoujishoSelectionToolbar(
    anchorAbove: anchorAbove,
    anchorBelow: anchorBelow,
    clipboardStatus: clipboardStatus!,
    creatorAction: (creatorAction != null)
        ? () {
            creatorAction?.call(
              delegate.textEditingValue.selection
                  .textInside(delegate.textEditingValue.text),
            );

            delegate.hideToolbar();
          }
        : null,
    sentenceAction: (sentenceAction != null)
        ? () {
            sentenceAction?.call(
              JidoujishoTextSelection(
                text: delegate.textEditingValue.text,
                range: TextRange(
                  start: delegate.textEditingValue.selection.start,
                  end: delegate.textEditingValue.selection.end,
                ),
              ),
            );

            delegate.hideToolbar();
          }
        : null,
    searchAction: (searchAction != null)
        ? () {
            searchAction?.call(
              delegate.textEditingValue.selection
                  .textInside(delegate.textEditingValue.text),
            );

            delegate.hideToolbar();
          }
        : null,
    stashAction: () {
      stashAction(
        delegate.textEditingValue.selection
            .textInside(delegate.textEditingValue.text),
      );

      delegate.hideToolbar();
    },
    shareAction: () {
      shareAction(
        delegate.textEditingValue.selection
            .textInside(delegate.textEditingValue.text),
      );

      delegate.hideToolbar();
    },
    handleCopy: canCopy(delegate) &amp;&amp; allowCopy
        ? () =&gt; handleCopy(delegate, clipboardStatus)
        : null,
    handleCut:
        canCut(delegate) &amp;&amp; allowCut ? () =&gt; handleCut(delegate) : null,
    handlePaste:
        canPaste(delegate) &amp;&amp; allowPaste ? () =&gt; handlePaste(delegate) : null,
    handleSelectAll: canSelectAll(delegate) &amp;&amp; allowSelectAll
        ? () =&gt; handleSelectAll(delegate)
        : null,
  );
}</code></pre>
</section>


  </div> <!-- /.main-content -->

  <div id="dartdoc-sidebar-left" class="sidebar sidebar-offcanvas-left">
    <header id="header-search-sidebar" class="hidden-l">
  <form class="search-sidebar" role="search">
    <input type="text" id="search-sidebar" autocomplete="off" disabled class="form-control typeahead" placeholder="Loading search...">
  </form>
</header>

<ol class="breadcrumbs gt-separated dark hidden-l" id="sidebar-nav">
  <li><a href="../../index.html">yuuna</a></li>
  <li><a href="../../utils/utils-library.html">utils</a></li>
  <li><a href="../../utils/JidoujishoTextSelectionControls-class.html">JidoujishoTextSelectionControls</a></li>
  <li class="self-crumb">buildToolbar method</li>
</ol>


    <h5>JidoujishoTextSelectionControls class</h5>
    <ol>

        <li class="section-title"><a href="../../utils/JidoujishoTextSelectionControls-class.html#constructors">Constructors</a></li>
          <li><a href="../../utils/JidoujishoTextSelectionControls/JidoujishoTextSelectionControls.html">JidoujishoTextSelectionControls</a></li>


        <li class="section-title">
          <a href="../../utils/JidoujishoTextSelectionControls-class.html#instance-properties">Properties</a>
        </li>
          <li><a href="../../utils/JidoujishoTextSelectionControls/allowCopy.html">allowCopy</a></li>
          <li><a href="../../utils/JidoujishoTextSelectionControls/allowCut.html">allowCut</a></li>
          <li><a href="../../utils/JidoujishoTextSelectionControls/allowPaste.html">allowPaste</a></li>
          <li><a href="../../utils/JidoujishoTextSelectionControls/allowSelectAll.html">allowSelectAll</a></li>
          <li><a href="../../utils/JidoujishoTextSelectionControls/creatorAction.html">creatorAction</a></li>
          <li><a href="../../utils/JidoujishoTextSelectionControls/handleColor.html">handleColor</a></li>
          <li class="inherited"><a href="https://api.flutter.dev/flutter/dart-core/Object/hashCode.html">hashCode</a></li>
          <li class="inherited"><a href="https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html">runtimeType</a></li>
          <li><a href="../../utils/JidoujishoTextSelectionControls/searchAction.html">searchAction</a></li>
          <li><a href="../../utils/JidoujishoTextSelectionControls/sentenceAction.html">sentenceAction</a></li>
          <li><a href="../../utils/JidoujishoTextSelectionControls/shareAction.html">shareAction</a></li>
          <li><a href="../../utils/JidoujishoTextSelectionControls/stashAction.html">stashAction</a></li>

        <li class="section-title"><a href="../../utils/JidoujishoTextSelectionControls-class.html#instance-methods">Methods</a></li>
          <li><a href="../../utils/JidoujishoTextSelectionControls/buildHandle.html">buildHandle</a></li>
          <li><a href="../../utils/JidoujishoTextSelectionControls/buildToolbar.html">buildToolbar</a></li>
          <li class="inherited"><a class="deprecated" href="https://api.flutter.dev/flutter/widgets/TextSelectionControls/canCopy.html">canCopy</a></li>
          <li class="inherited"><a class="deprecated" href="https://api.flutter.dev/flutter/widgets/TextSelectionControls/canCut.html">canCut</a></li>
          <li class="inherited"><a class="deprecated" href="https://api.flutter.dev/flutter/widgets/TextSelectionControls/canPaste.html">canPaste</a></li>
          <li class="inherited"><a class="deprecated" href="https://api.flutter.dev/flutter/material/MaterialTextSelectionControls/canSelectAll.html">canSelectAll</a></li>
          <li><a href="../../utils/JidoujishoTextSelectionControls/getHandleAnchor.html">getHandleAnchor</a></li>
          <li><a href="../../utils/JidoujishoTextSelectionControls/getHandleSize.html">getHandleSize</a></li>
          <li class="inherited"><a class="deprecated" href="https://api.flutter.dev/flutter/widgets/TextSelectionControls/handleCopy.html">handleCopy</a></li>
          <li class="inherited"><a class="deprecated" href="https://api.flutter.dev/flutter/widgets/TextSelectionControls/handleCut.html">handleCut</a></li>
          <li class="inherited"><a class="deprecated" href="https://api.flutter.dev/flutter/widgets/TextSelectionControls/handlePaste.html">handlePaste</a></li>
          <li class="inherited"><a class="deprecated" href="https://api.flutter.dev/flutter/widgets/TextSelectionControls/handleSelectAll.html">handleSelectAll</a></li>
          <li class="inherited"><a href="https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html">noSuchMethod</a></li>
          <li class="inherited"><a href="https://api.flutter.dev/flutter/dart-core/Object/toString.html">toString</a></li>

        <li class="section-title inherited"><a href="../../utils/JidoujishoTextSelectionControls-class.html#operators">Operators</a></li>
          <li class="inherited"><a href="https://api.flutter.dev/flutter/dart-core/Object/operator_equals.html">operator ==</a></li>




</ol>

  </div><!--/.sidebar-offcanvas-->

  <div id="dartdoc-sidebar-right" class="sidebar sidebar-offcanvas-right">
  </div><!--/.sidebar-offcanvas-->

</main>

<footer>
  <span class="no-break">
    yuuna
      2.8.0+93
  </span>

  
</footer>



<script src="../../static-assets/highlight.pack.js?v1"></script>
<script src="../../static-assets/docs.dart.js"></script>



</body>

</html>

